package com.hua.yuan.ui.data;
import com.hua.yuan.base.Constents;
import com.hua.yuan.http.Actions;
import com.hua.yuan.http.GetDataTask;
import com.hua.yuan.http.RequestPramsMap;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.Map;
import cm.hua.yuan.common.utils.PreferenceUtils;

/**
 * Created by huangyang on 2018/5/14.
 * 图集相关的接口请求
 */

public class PictureDataRequest {


    /**
     * 获取轮播图的数据
     *
     * @param token          token
     * @param stringCallback 结果
     */
    public static void getPictureRot(String token, StringCallback stringCallback) {

        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .getHashMap();

        GetDataTask.getDataPost(Actions.PICTURES_ROTATION, hashMap, stringCallback);
    }

    /**
     * 获取子分类轮播图的数据
     *
     * @param token          token
     * @param stringCallback 结果
     */
    public static void getPictureSubRot(String token, String type, StringCallback stringCallback) {

        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("type", type)
                .getHashMap();

        GetDataTask.getDataPost(Actions.PICTURES_ROTATION, hashMap, stringCallback);
    }


    /**
     * 获取首页的数据
     *
     * @param token          token
     * @param stringCallback 结果
     */
    public static void getPictureIndex(String token, StringCallback stringCallback) {

        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .getHashMap();

        GetDataTask.getDataPost(Actions.PICTURES_INDEX, hashMap, stringCallback);


    }

    /**
     * 获取图集列表
     *
     * @param token token
     * @param type  类型，1：火热推荐，2：付费精品，3：包月精选，4：69特价
     * @param from  从第几条开始，默认为0（type为0时，无效）
     * @param num   展示的数量，默认为10
     */
    public static void getPictures(String token, int type, int from, int num, StringCallback stringCallback) {

        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("type", String.valueOf(type))
                .put("from", String.valueOf(from))
                .put("num", String.valueOf(num))
                .getHashMap();

        GetDataTask.getDataPost(Actions.GET_PICTURES, hashMap, stringCallback);

    }

    public static void getPictures(String token, int type, int from, int num, int is_recommend, StringCallback stringCallback) {

        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("type", String.valueOf(type))
                .put("from", String.valueOf(from))
                .put("num", String.valueOf(num))
                .put("is_recommend", String.valueOf(is_recommend))//是否为推荐接口，1是，0否
                .getHashMap();

        GetDataTask.getDataPost(Actions.GET_PICTURES, hashMap, stringCallback);

    }
    /**
     * 获取图集列表
     *
     * @param token token
     * @param type  类型，1：火热推荐，2：付费精品，3：包月精选，4：69特价
     * @param from  从第几条开始，默认为0（type为0时，无效）
     * @param num   展示的数量，默认为10
     */
    public static void getPicturesSubList(String token, int type, int subtype, int from, int num, StringCallback stringCallback) {

        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("type", String.valueOf(type))
                .put("subtype", String.valueOf(subtype))
                .put("from", String.valueOf(from))
                .put("num", String.valueOf(num))
                .getHashMap();

        GetDataTask.getDataPost(Actions.GET_PICTURES, hashMap, stringCallback);

    }

    /**
     * 图集搜索接口
     *
     * @param slug  搜索参数
     */
    public static void getSearchPictures(String slug, StringCallback stringCallback) {
        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("slug", slug)
                .getHashMap();

        GetDataTask.getDataPost(Actions.SEARCH_PICTURES, hashMap, stringCallback);

    }

    /**
     * 图集搜索历史接口
     */
    public static void getPictureSearchHistory(StringCallback stringCallback) {

        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .getHashMap();

        GetDataTask.getDataPost(Actions.PICTURE_SEARCH_HISTORY, hashMap, stringCallback);
    }

    /**
     * 图集详情接口
     *
     * @param atlas_id       图集的id
     * @param stringCallback 结果
     */
    public static void getPictureDetail(String atlas_id, StringCallback stringCallback) {

        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("atlas_id", atlas_id)
                .getHashMap();

        GetDataTask.getDataPost(Actions.PICTURE_DETAIL, hashMap, stringCallback);

    }

    /**
     * 子栏目推荐列表
     *
     * @param type       图集的类型
     * @param stringCallback 结果
     */
    public static void getPicturesSubIndex(String type, StringCallback stringCallback) {

        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("type", type)
                .getHashMap();

        GetDataTask.getDataPost(Actions.PICTURES_SUB_INDEX, hashMap, stringCallback);

    }

    /**
     * 图集评论信息接口
     *
     * @param stringCallback 结果
     */
    public static void getPictureComment(String picture_id, StringCallback stringCallback) {

        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("picture_id", picture_id)
                .put("token", token)
                .getHashMap();

        GetDataTask.getDataPost(Actions.PICTURE_COMMENT, hashMap, stringCallback);

    }

    /**
     * 图集添加评论信息接口
     *
     * @param picture_id       图集的类型
     * @param stringCallback 结果
     */
    public static void addPictureComment(String picture_id, String comment, StringCallback stringCallback) {

        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("picture_id", picture_id)
                .put("comment", comment)
                .getHashMap();

        GetDataTask.getDataPost(Actions.ADD_PICTURE_COMMENT, hashMap, stringCallback);

    }
    /**
     * 图集添加评论点赞
     *
     * @param stringCallback 结果
     */
    public static void likePictureComment(String picture_comment_id, StringCallback stringCallback) {

        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("picture_comment_id", picture_comment_id)
                .getHashMap();

        GetDataTask.getDataPost(Actions.LIKE_PICTURE_COMMENT, hashMap, stringCallback);

    }

    /**
     * 图集收藏
     *
     * @param stringCallback 结果
     */
    public static void altasCollect(String atlas_id, String type, StringCallback stringCallback) {

        String token = PreferenceUtils.getString(Constents.TOKEN, "");
        Map<String, String> hashMap = new RequestPramsMap.Builder()
                .put("token", token)
                .put("atlas_id", atlas_id)
                .put("type", type)//（1收藏、0取消）
                .getHashMap();

        GetDataTask.getDataPost(Actions.ALTAS_COLLECT, hashMap, stringCallback);

    }

    /**
     * 购买视频
     *
     * @param token          token
     * @param id             视频的id
     * @param stringCallback 结果
     */
//    public static void buyMovie(String token, String id, StringCallback stringCallback) {
//
//        Map<String, String> hashMap = new RequestPramsMap.Builder()
//                .put("token", token)
//                .put("id", id)
//                .getHashMap();
//
//        GetDataTask.getDataPost(Actions.MOVIE_BUY, hashMap, stringCallback);
//
//    }

    /**
     * 取消或者收藏视频
     *
     * @param token          token
     * @param type           1：代表收藏，2：代表取消收藏
     * @param id             视频的id
     * @param stringCallback 结果
     */
//    public static void movieCollect(String token, String type, String id, StringCallback stringCallback) {
//        Map<String, String> hashMap = new RequestPramsMap.Builder()
//                .put("token", token)
//                .put("id", String.valueOf(id))
//                .put("type", type)
//                .getHashMap();
//
//        GetDataTask.getDataPost(Actions.MOVIE_COLLECT, hashMap, stringCallback);
//
//        ShowUrl.createPostUrl(Actions.MOVIE_COLLECT, hashMap);
//
//
//    }

    /**
     * 获取收藏列表
     *
     * @param token          token
     * @param from           从第几条开始，默认为0（type为0时，无效）
     * @param num            展示的数量，默认为10
     * @param stringCallback 结果
     */
//    public static void getCollectMovieList(String token, int from, int num, StringCallback stringCallback) {
//
//        Map<String, String> hashMap = new RequestPramsMap.Builder()
//                .put("token", token)
//                .put("from", String.valueOf(from))
//                .put("num", String.valueOf(num))
//                .getHashMap();
//
//        GetDataTask.getDataPost(Actions.MOVIE_COLLECT_LIST, hashMap, stringCallback);
//
//    }


    /**
     * 发送评论的接口
     *
     * @param token          token
     * @param id             视频的id
     * @param comment        发送的内容
     * @param stringCallback 结果
     */
//    public static void sendComment(String token, String id, String comment, StringCallback stringCallback) {
//
//
//        Map<String, String> hashMap = new RequestPramsMap.Builder()
//                .put("token", token)
//                .put("id", id)
//                .put("comment", comment)
//                .getHashMap();
//
//        GetDataTask.getDataPost(Actions.COMMENT_MOVIES, hashMap, stringCallback);
//
//
//    }

    /**
     * 评论点赞
     *
     * @param token          token
     * @param id             评论的id
     * @param stringCallback 结果
     */
//    public static void videoLike(String token, String id, StringCallback stringCallback) {
//        Map<String, String> hashMap = new RequestPramsMap.Builder()
//                .put("token", token)
//                .put("id", id)
//                .getHashMap();
//
//        GetDataTask.getDataPost(Actions.LIKE_MOVIE_COMMENT, hashMap, stringCallback);
//
//    }


}
